/**
 * @Description: 判断是否空字符串
 * @Author: knight
 * @Date: 2021/3/17 14:49
 */
export const isEmptyString = (value: any): boolean => {
  return (
    value === undefined || value === null || value.toString().trim() === ""
  );
};

/**
 * @Description: 判断对象不是空字符串
 * @Author: knight
 * @Date: 2021-09-13 14:18:36
 */
export const isNotEmptyString = (value: any): boolean => !isEmptyString(value);

/**
 * @Description: 判断对象是否为空
 * @Author: knight
 * @Date: 2021/3/26 13:07
 */
export const isEmptyObject = (data: any): boolean =>
  data === undefined || data === null;

/**
 * @Description: 判断对象是否不为空
 * @Author: knight
 * @Date: 2021/3/26 13:10
 */
export const isNotEmptyObject = (data: any): boolean => !isEmptyObject(data);

/**
 * @Description: 获取下拉框数据
 * @Author: ZhangHan
 * @Date: 2025-05-13 09:09:45
 */
export function getSelectData(valueEnum: ValueEnumType) {
  const options: any[] = [];
  if (isEmptyObject(valueEnum)) {
    return options;
  }

  Object.getOwnPropertyNames(valueEnum).map((data: any) => {
    options.push({
      ...valueEnum?.[data],
      label: valueEnum?.[data]?.text,
      value: String(data),
      disabled: valueEnum?.[data]?.disabled === 0,
    });
  });
  return options;
}
